<template>
    <div class="good">
        <div class="good-header">
            <slot name="title">默认标题</slot>
        </div>
        <ul class="good-box">
            <router-link v-for="item in dataItem" :key="item.goodsId" class="good-item" tag="li" :to="('/info/'+item.goodsId)">
                <div class="img_box">
                    <img :src="item.goodsCoverImg" alt="">
                </div>
                <div class="good-desc">
                    <div class="title">{{ item.goodsName }}</div>
                    <div class="price">{{ item.sellingPrice | money }}</div>
                </div>
            </router-link>
        </ul>
    </div>
</template>

<script>
export default {
    name: "Goods",
    props: {
        dataItem: {
            type: Array,
            required: true
        }
    },
    data() {
        return {

        };
    },
    methods: {},
};
</script>

<style lang="less">
.good {
    width: 100%;
    background: rgb(243, 243, 243);

    .good-header {
        height: 50px;
        line-height: 50px;
        font-size: 16px;
        font-weight: 500;
        color: rgb(15, 196, 181);
    }

    .good-box {
        margin: 0 auto;
        width: 98%;
        display: flex;
        flex-wrap: wrap;
        justify-content: space-between;

        .good-item {
            width: 49%;
            background: white;
            margin: 3.5px 0;
            box-sizing: border-box;

            .img_box {
                width: 90%;
                height: 170px;
                margin: 10px auto;
                overflow: hidden;
                padding-top: 10px;
            }

            .good-desc {
                .title {
                    font-size: 14px;
                    padding: 10px;
                }

                .price {
                    font-size: .32rem;
                    color: red;
                    padding-bottom: 10px;
                    text-align: center;
                    font-size: 16px;
                }
            }

            img {
                width: 100%;
                height: auto;
            }
        }
    }
}
</style>